package com.testmanager.testmananger.quantitative.mapper;


import com.testmanager.testmananger.quantitative.domain.TaskInfoEntity;
import com.testmanager.testmananger.quantitative.dto.TaskInfoDto;
import com.testmanager.testmananger.quantitative.dto.WorkerDto;

import java.util.List;

public class TaskInfoMapper {

    public static TaskInfoDto toTaskInfoDto(TaskInfoEntity taskInfoEntity, List<WorkerDto> workers){
        TaskInfoDto taskInfoDto = new TaskInfoDto();
        return taskInfoDto.setId(taskInfoEntity.getId())
                .setName(taskInfoEntity.getName())
                .setProgress(taskInfoEntity.getProgress())
                .setComment(taskInfoEntity.getComment())
                .setTaskNo(taskInfoEntity.getTaskno())
                .setWorkers(workers);
    }

    public static TaskInfoEntity toTaskInfoEntity(Long ownno,TaskInfoDto taskInfoDto){
            TaskInfoEntity taskInfoEntity = new TaskInfoEntity();
            return taskInfoEntity.setId(taskInfoDto.getId())
                    .setName(taskInfoDto.getName())
                    .setProgress(taskInfoDto.getProgress())
                    .setComment(taskInfoDto.getComment())
                    .setOwnerNo(ownno)
                    .setTaskno(taskInfoDto.getTaskNo());
    }

}
